Skip to content

feat: Introduce separate replica version - #11401

Merged
frankdavid merged 23 commits into
masterfrom
frankdavid/include-guestos-version
Sep 8, 2026
Merged

feat: Introduce separate replica version#11401
frankdavid merged 23 commits into
masterfrom
frankdavid/include-guestos-version

Conversation

@frankdavid

@frankdavid frankdavid commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

There used to be a single version: the one under /opt/ic/share/version.txt, read by the orchestrator and passed to the replica. During fast GuestOS upgrade, the replica binaries are hot-swapped via an overlay while the node keeps running the old GuestOS. The base GuestOS version and the replica version must be distinguished.

  • PlatformVersion (new struct in ic-types, next to ReplicaVersion) holds both guestos_version (the GuestOS the node booted from) and replica_version (the running replica binary). replica_version: ReplicaVersion in ReplicaConfig is replaced by platform_version: PlatformVersion.
  • Build: the GuestOS image now ships a second version artifact, /opt/ic/share/replica_version.txt (plus its -test variant). During a fast upgrade, the sysext overlay will shadow it with the post-upgrade version, while version.txt — now explicitly the GuestOS version — is never shadowed.
  • Orchestrator: reads both files (--replica-version-file → replica version, --guestos-version-file → GuestOS version) and passes them when starting the replica process.
  • Observability: /api/v2/status gains an optional guestos_version field alongside impl_version.
  • Metrics: custom-metrics.sh now also exports a replica_version metric.

There used to be a single version: the one under `/opt/ic/share/version.txt`, read by the orchestrator and passed to the replica. During fast GuestOS upgrade, the replica binaries are hot-swapped via an overlay while the node keeps running the old GuestOS. The base GuestOS version and the replica version must be distinguished.

- **`PlatformVersion`** (new struct in `ic-types`, next to `ReplicaVersion`) holds both `guestos_version` (the GuestOS the node booted from) and `replica_version` (the running replica binary). `replica_version: ReplicaVersion` in ``ReplicaConfig` is replaced by `platform_version: PlatformVersion`.
- **Build**: the GuestOS image now ships a second version artifact, `/opt/ic/share/binary_version.txt` (plus its `-test` variant). During a fast upgrade, the sysext overlay will shadow it with the post-upgrade version, while `version.txt` — now explicitly the GuestOS version — is never shadowed.
- **Orchestrator**: reads both files (`--version-file` → binary version, `--guestos-version-file` → GuestOS version) and passes them when starting the replica process.
- **Observability**: `/api/v2/status` gains an optional `guestos_version` field alongside `impl_version`.
- **Metrics**: `custom-metrics.sh` now also exports a binary_version metric.
@frankdavid
frankdavid requested review from a team as code owners September 1, 2026 15:15
@github-actions github-actions Bot added the feat label Sep 1, 2026
@zeropath-ai

zeropath-ai Bot commented Sep 1, 2026

Copy link
Copy Markdown

No security or compliance issues detected. Reviewed everything up to 5e4e48e.

Security Overview
Detected Code Changes
Change Type Relevant files
Enhancement ► ic-os/components/guestos/ic-replica.service
    ExecStart argument changes for replica/guestos versioning
► ic-os/components/monitoring/guestos/custom-metrics.sh
    Add replica_version metric and read replica version file
► ic-os/components/monitoring/metrics-proxy/guestos/metrics-proxy.yaml
    Keep replica_version metric in proxies
► rs/boundary_node/ic_boundary/src/http/handlers.rs
    Include guestos_version in status response
► rs/consensus/dkg/src/dkg_key_manager.rs
    Use platform_version instead of replica_version in tests and config
► rs/consensus/dkg/src/lib.rs
    Extract platform_version from ReplicaConfig and preserve replica_version via platform_version field
► rs/consensus/dkg/src/payload_validator.rs
    Adjust tests to use platform_version in replica config
► rs/consensus/mocks/src/lib.rs
    Update mock to include PlatformVersion and adjust replica_version handling
► rs/consensus/src/consensus/batch_delivery.rs
    Use platform_version in replica config for tests
► rs/consensus/src/consensus/block_maker.rs
    Pass replica_version() from config instead of direct replica_version
► rs/consensus/src/consensus/catchup_package_maker.rs
    Use replica_version() from config in package creation
► rs/consensus/src/consensus/finalizer.rs
    Switch to replica_version() for finalization metadata
► rs/consensus/src/consensus/malicious_consensus.rs
    Use replica_version() from config in content creation
► rs/consensus/src/consensus/notary.rs
    Use replica_version() from config for notarization content
► rs/consensus/src/consensus/random_beacon_maker.rs
    Use replica_version() from config for beacon content
► rs/consensus/src/consensus/random_tape_maker.rs
    Use replica_version() from config for random tape content
► rs/consensus/src/consensus/share_aggregator.rs
    Use platform_version in tests instead of replica_version in several places
► rs/consensus/src/consensus/validator.rs
    Use replica_version() from config for validation checks
► rs/consensus/tests/framework/types.rs
    Pass replica_version() instead of direct replica_version in consensus setup
► rs/consensus/tests/payload.rs
    Update types to include PlatformVersion and adjust replica_config construction
► rs/http_endpoints/public/src/dashboard.rs\n     Switch to PlatformVersion and display replica_version via platform_version
► rs/http_endpoints/public/src/lib.rs
    Update public endpoints to use PlatformVersion in routing/config
► rs/http_endpoints/public/src/status.rs
    Update status to expose PlatformVersion and guestos_version
► rs/http_endpoints/public/templates/dashboard.html
    Display replica_version via platform_version and add GuestOS Version
► rs/http_endpoints/public/tests/common/mod.rs
    Update test imports to use test_platform_version instead of test_replica_version
► rs/determinism_test/src/setup.rs
    Update replica_config to use platform_version in setup
► rs/consensus/tests/framework/test_runner.rs
    Update test data generation to use test_platform_version
► rs/consensus/tests/payload.rs
    Adjust consensus payload tests to incorporate PlatformVersion
► rs/http_endpoints/public/src/status.rs
    Replace replica_version references with platform_version in status responses
► rs/http_endpoints/public/src/dashboard.rs
    Adjust dashboard data model to include PlatformVersion andGuestOS fields
► rs/http_endpoints/public/src/dashboard.rs
    Update dashboard HTML to show GuestOS Version and PlatformVersion fields

@zeropath-ai

zeropath-ai Bot commented Sep 1, 2026

Copy link
Copy Markdown

No security or compliance issues detected. Reviewed everything up to 5e4e48e.

Security Overview
Detected Code Changes
Change Type Relevant files
Enhancement ► ic-os/components/guestos/ic-replica.service
    Update ExecStart and add replica/version file references to replica_version.txt and version.txt
► ic-os/components/monitoring/guestos/custom-metrics.sh
    Add replica_version metric and read from replica_version.txt
► ic-os/components/monitoring/metrics-proxy/guestos/metrics-proxy.yaml
    Keep replica_version metric for replica/version tracking
► ic-os/defs.bzl
    Introduce copy_replica_version_txt and test_replica_version_txt rules for replica_version.txt
► rs/boundary_node/ic_boundary/src/http/handlers.rs
    Add guestos_version field in status response
► rs/consensus/dkg/src/dkg_key_manager.rs
    Update tests to use test_platform_version instead of test_replica_version for platform/version handling
► rs/consensus/dkg/src/lib.rs
    Refactor DkgImpl to set node_id/subnet_id with updated replica_version handling via replica_config.replica_version()
► rs/consensus/mocks/src/lib.rs
    Use PlatformVersion and adjust replica_version handling to replica_version() in mocks
► rs/consensus/src/consensus/batch_delivery.rs
    Update tests to use test_platform_version for platform_version instead of test_replica_version
► rs/consensus/src/consensus/block_maker.rs
    Use replica_version() from replica_config where referenced
► rs/consensus/src/consensus/catchup_package_maker.rs
    Use replica_version() from replica_config in package creation
► rs/consensus/src/consensus/finalizer.rs
    Use replica_version() from replica_config in finalization logic
► rs/consensus/src/consensus/malicious_consensus.rs
    Use replica_version() from replica_config in content creation
► rs/consensus/src/consensus/notary.rs
    Use replica_version() from replica_config in notary and notarization content
► rs/consensus/src/consensus/random_beacon_maker.rs
    Use replica_version() from replica_config in beacon content
► rs/consensus/src/consensus/random_tape_maker.rs
    Use replica_version() from replica_config in random tape content
► rs/consensus/src/consensus/share_aggregator.rs
    Use replica_version() from replica_config in tests and configurations
► rs/consensus/src/consensus/validator.rs
    Replace replica_version reference with replica_version() from replica_config in validation logic
► rs/consensus/tests/framework/types.rs
    Use replica_version() from replica_config in consensus dependencies
► rs/consensus/tests/payload.rs
    Update ReplicaConfig to include platform_version with guestos_version and replica_version fields
► rs/determinism_test/src/setup.rs
    Use platform_version (test_platform_version) instead of test_replica_version in replica_config
► rs/http_endpoints/public/src/dashboard.rs
    Dashboard displays platform_version and guestos_version instead of replica_version
► rs/http_endpoints/public/src/lib.rs
    Use PlatformVersion in public HTTP endpoints instead of ReplicaVersion
► rs/http_endpoints/public/src/status.rs
    Status endpoint uses PlatformVersion and guestos_version fields
► rs/http_endpoints/public/templates/dashboard.html
    Display platform_version.replica_version and platform_version.guestos_version
► rs/http_endpoints/public/tests/common/mod.rs
    Switch test imports from test_replica_version to test_platform_version
► rs/consensus/tests/framework/test_runner.rs
    Switch imports to test_platform_version for platform/version handling
► rs/http_endpoints/public/src/dashboard.rs
    Prefix changes reflect platform_version usage in dashboard wiring
► rs/consensus/tests/payload.rs
    Update payload tests to construct platform_version alongside replica_version in ReplicaConfig

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Introduces separate GuestOS and replica binary version tracking for fast upgrades.

Changes:

  • Adds PlatformVersion and propagates it through replica and consensus.
  • Exposes GuestOS version through status APIs and metrics.
  • Packages separate GuestOS and binary version artifacts.

Reviewed changes

Copilot reviewed 42 out of 42 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
rs/types/types/src/replica_version.rs Defines PlatformVersion.
rs/types/types/src/replica_config.rs Uses platform version configuration.
rs/types/types/src/messages/http/tests.rs Updates status fixtures.
rs/types/types/src/messages/http.rs Adds GuestOS status field.
rs/types/types/src/lib.rs Exports PlatformVersion.
rs/types/types_test_utils/src/ids.rs Adds platform-version fixture.
rs/replica/src/setup_ic_stack.rs Propagates platform versions.
rs/replica/src/args.rs Adds GuestOS version argument.
rs/replica/setup_ic_network/src/lib.rs Passes platform versions into consensus.
rs/replica/bin/replica/main.rs Constructs runtime platform version.
rs/replica_tests/src/lib.rs Updates replica test setup.
rs/replay/src/validator.rs Updates replay configuration.
rs/orchestrator/src/upgrade.rs Tracks both versions during upgrades.
rs/orchestrator/src/processes.rs Passes both versions to replicas.
rs/orchestrator/src/orchestrator.rs Loads both version files.
rs/orchestrator/src/args.rs Adds GuestOS version-file argument.
rs/https_outcalls/consensus/src/pool_manager.rs Uses binary version for artifacts.
rs/http_endpoints/public/tests/common/mod.rs Updates endpoint test setup.
rs/http_endpoints/public/src/status.rs Reports both versions.
rs/http_endpoints/public/src/lib.rs Propagates platform versions.
rs/determinism_test/src/setup.rs Updates determinism fixture.
rs/consensus/tests/payload.rs Updates payload test configuration.
rs/consensus/tests/framework/types.rs Uses nested replica version.
rs/consensus/tests/framework/test_runner.rs Updates consensus fixtures.
rs/consensus/src/consensus/validator.rs Validates binary versions.
rs/consensus/src/consensus/share_aggregator.rs Updates test configuration.
rs/consensus/src/consensus/random_tape_maker.rs Emits binary version.
rs/consensus/src/consensus/random_beacon_maker.rs Emits binary version.
rs/consensus/src/consensus/notary.rs Uses binary version.
rs/consensus/src/consensus/malicious_consensus.rs Uses binary version.
rs/consensus/src/consensus/finalizer.rs Uses binary version.
rs/consensus/src/consensus/catchup_package_maker.rs Uses binary version.
rs/consensus/src/consensus/block_maker.rs Uses binary version.
rs/consensus/src/consensus/batch_delivery.rs Updates test configuration.
rs/consensus/mocks/src/lib.rs Builds platform-version mocks.
rs/consensus/dkg/src/payload_validator.rs Updates test configuration.
rs/consensus/dkg/src/lib.rs Extracts binary version for DKG.
rs/consensus/dkg/src/dkg_key_manager.rs Updates test configuration.
rs/boundary_node/ic_boundary/src/http/handlers.rs Updates status response construction.
ic-os/defs.bzl Packages binary version artifacts.
ic-os/components/monitoring/guestos/custom-metrics.sh Adds binary-version metric.
ic-os/components/guestos/ic-replica.service Supplies both version files.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread ic-os/components/monitoring/guestos/custom-metrics.sh Outdated
Comment thread rs/http_endpoints/public/src/status.rs
@frankdavid
frankdavid requested a review from a team as a code owner September 1, 2026 16:00
@frankdavid
frankdavid requested a balanced review from Copilot September 1, 2026 16:00
@github-actions github-actions Bot added the @dre label Sep 1, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 44 out of 44 changed files in this pull request and generated 2 comments.

Comment thread rs/orchestrator/src/processes.rs
Comment thread rs/consensus/tests/framework/test_runner.rs Outdated
Comment thread ic-os/components/guestos/ic-replica.service Outdated
Comment thread rs/consensus/mocks/src/lib.rs Outdated
Comment thread rs/types/types/src/replica_config.rs
Comment thread rs/orchestrator/src/orchestrator.rs Outdated
Comment thread rs/orchestrator/src/orchestrator.rs Outdated
Comment thread rs/replica/bin/replica/main.rs
Co-authored-by: Pierugo Pace <pierugo.pace@dfinity.org>
Comment thread rs/consensus/src/consensus/block_maker.rs Outdated
Comment thread rs/consensus/src/consensus/block_maker.rs Outdated
Comment thread rs/http_endpoints/public/src/lib.rs Outdated
Comment thread rs/https_outcalls/consensus/src/pool_manager.rs Outdated
Comment thread rs/types/types_test_utils/src/ids.rs Outdated
Comment thread rs/orchestrator/src/orchestrator.rs Outdated
Comment thread rs/orchestrator/src/orchestrator.rs Outdated
Comment thread rs/replay/src/validator.rs Outdated
Comment thread rs/replica/bin/replica/main.rs Outdated
Comment thread rs/replica/src/setup_ic_stack.rs Outdated
Comment thread rs/http_endpoints/public/src/lib.rs Outdated
Comment thread rs/replay/src/validator.rs Outdated
Comment thread rs/orchestrator/src/orchestrator.rs Outdated
Comment thread ic-os/components/monitoring/guestos/custom-metrics.sh
Comment thread rs/orchestrator/src/metrics.rs Outdated
Comment thread rs/replay/src/cmd.rs Outdated
Comment thread rs/types/types/src/replica_version.rs
frankdavid and others added 4 commits September 7, 2026 13:50
Co-authored-by: Pierugo Pace <pierugo.pace@dfinity.org>
Co-authored-by: Pierugo Pace <pierugo.pace@dfinity.org>
@frankdavid
frankdavid added this pull request to the merge queue Sep 8, 2026
@frankdavid
frankdavid removed this pull request from the merge queue due to a manual request Sep 8, 2026
@frankdavid
frankdavid added this pull request to the merge queue Sep 8, 2026
Merged via the queue into master with commit 5a7458b Sep 8, 2026
46 checks passed
@frankdavid
frankdavid deleted the frankdavid/include-guestos-version branch September 8, 2026 09:49
dfinityianblenke added a commit that referenced this pull request Sep 8, 2026
… versions

PR #11401 replaced the single ReplicaVersion::set_default_version() call
with a PlatformVersion (guestos_version + replica_version) reported via
the ic_replica_info metric, to distinguish the two during fast GuestOS
upgrades.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VnwZHP5Bm5AEaugi8a96Hu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants